<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta id="viewport" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>讲解员管理</title>
    <link type="favicon" rel="shortcut icon" href="./static/img/favicon.ico" />
    <link rel="stylesheet" href="./static/css/bootstrap.css">
    <link rel="stylesheet" href="./static/css/init.css">
    <link rel="stylesheet" href="./static/less/common.css">
    <link rel="stylesheet" href="./static/less/narrator.css">
    <link href="./static/css/spop.min.css" rel="stylesheet"/>
    <script src="./static/js/Syunew6.js"></script>
    <script src="./static/js/isLogin.js"></script>
</head>
<body>
    <div id="narrator" class="narrator-box common-box">
        <div class="head-box">
            <div class="logo-box">
                <img class="logo" src="./static/img/logo_1.png" alt="">
                <span class="title">成都杜甫草堂博物馆综合信息管理平台</span>
            </div>
            <div class="user-box">
                <div class="name">{{userData.userName}}，欢迎您</div>
                <div class="logout">
                    <span @click="logout" class="cus">
                        <i class="glyphicon glyphicon-log-out"></i>
                        <span>登出</span>
                    </span>
                </div>
            </div>
        </div>
        <div class="content">
            <div class="address-box">
                <div class="address">
                    <a class="href" href="/index.html">首页</a>
                    <i class="glyphicon glyphicon-menu-right right"></i>
                    <span>讲解员管理</span>
                </div>
                <div class="time">
                    {{date + '&nbsp;星期' + week + '&nbsp;' + time}}
                </div>
            </div>
            <!-- tab大屏 -->
            <div class="tab">
                <p class="title" :class="tabCurrent == 1 ? 'current' : 'cus'" v-if="menuConfig('讲解员录入')" @click="tabClick(1)">讲解员录入</p>
                <p class="title" :class="tabCurrent == 2 ? 'current' : 'cus'" v-if="menuConfig('讲解员查询')" @click="tabClick(2)">讲解员查询</p>
                <p class="title" :class="tabCurrent == 3 ? 'current' : 'cus'" v-if="menuConfig('讲解工作录入')" @click="tabClick(3)">讲解员工作日志</p>
                <p class="title" :class="tabCurrent == 4 ? 'current' : 'cus'" v-if="menuConfig('讲解工作查询')" @click="tabClick(4)">讲解工作查询</p>
            </div>
            <!-- tab小屏 -->
            <div class="container tab2">
                <div class="navbar-header">
                    <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#bs-navbar" aria-controls="bs-navbar" aria-expanded="true">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand">{{tabs[tabCurrent]}}</a>
                </div>
                <nav id="bs-navbar" class="navbar-collapse collapse in" aria-expanded="true">
                    <ul class="nav navbar-nav">
                        <li v-if="menuConfig('讲解员录入')">
                            <a :class="tabCurrent == 1 ? 'current' : ''" @click="tabClick(1)">讲解员录入</a>
                        </li>
                        <li v-if="menuConfig('讲解员查询')">
                            <a :class="tabCurrent == 2 ? 'current' : ''" @click="tabClick(2)">讲解员查询</a>
                        </li>
                        <li v-if="menuConfig('讲解工作录入')">
                            <a :class="tabCurrent == 3 ? 'current' : ''" @click="tabClick(3)">讲解工作录入</a>
                        </li>
                        <li v-if="menuConfig('讲解工作查询')">
                            <a :class="tabCurrent == 4 ? 'current' : ''" @click="tabClick(4)">讲解工作查询</a>
                        </li>
                    </ul>
                </nav>
            </div>
                  
            <div class="con-box">
                <!-- 讲解员录入 -->
                <div class="clearfix" v-if="tabCurrent == 1">
                    <form class="form-horizontal form col-lg-8 col-md-10 col-sm-12 col-xs-12">
                        <div class="form-group">
                            <label for="groupName" class="col-sm-2 control-label"><span class="red">*</span>组别</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="groupName" v-model="addNarratorForm.groupName">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="name" class="col-sm-2 control-label"><span class="red">*</span>姓名</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="name" v-model="addNarratorForm.name">
                            </div>
                        </div>
                        <div class="form-group mt24">
                            <label for="exampleInputFile" class="col-sm-2 control-label"><span class="red">*</span>照片</label>
                            <div class="col-sm-9 col-md-10 update-box">
                                <label for="exampleInputFile" class="filebtn cus">
                                    <input type="file" class="update" id="exampleInputFile" accept="image/*" @change="imgUpload($event,1)">
                                    选择图片
                                </label>
                                <p class="help-block">建议上传一寸大小图片</p>
                                <div class="userImg-box">
                                    <img class="userImg" v-if="addNarratorForm.img" :src="baseUrl + addNarratorForm.img" alt="">
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="sex" class="col-sm-2 control-label"><span class="red">*</span>性别</label>
                            <div class="col-sm-10">
                                <select class="form-control" v-model="addNarratorForm.sex">
                                    <option style='display: none' value="">请选择</option>
                                    <option value="1">男</option>
                                    <option value="0">女</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="education" class="col-sm-2 control-label"><span class="red">*</span>学历</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="education" v-model="addNarratorForm.education">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="joinTime" class="col-sm-2 control-label"><span class="red">*</span>入职时间</label>
                            <div class="col-sm-10">
                                <input type="date" class="form-control" id="joinTime" v-model="addNarratorForm.hiredate">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="level" class="col-sm-2 control-label"><span class="red">*</span>岗级</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="level" v-model="addNarratorForm.jobLevel">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="language" class="col-sm-2 control-label"><span class="red">*</span>语种</label>
                            <div class="col-sm-10">
                                <!-- <select class="form-control" v-model="addNarratorForm.languageType">
                                    <option style="display: none">请选择</option>
                                    <option value="0">汉语</option>
                                    <option value="1">英语</option>
                                    <option value="2">日语</option>
                                    <option value="3">韩语</option>
                                </select> -->
                                <label class="checkbox-inline">
                                    <input type="checkbox" name="lan" value="0" :checked="addNarratorForm.languageType.indexOf('中文')>=0" @click="checkedOne('中文')"> 中文
                                </label>
                                <label class="checkbox-inline">
                                    <input type="checkbox" name="lan" value="1" :checked="addNarratorForm.languageType.indexOf('英文')>=0" @click="checkedOne('英文')"> 英文
                                </label>
                                <label class="checkbox-inline">
                                    <input type="checkbox" name="lan" value="2" :checked="addNarratorForm.languageType.indexOf('日文')>=0" @click="checkedOne('日文')"> 日文
                                </label>
                                <label class="checkbox-inline">
                                    <input type="checkbox" name="lan" value="3" :checked="addNarratorForm.languageType.indexOf('韩文')>=0" @click="checkedOne('韩文')"> 韩文
                                </label>
                                <label class="checkbox-inline">
                                    <input type="checkbox" name="lan" value="4" :checked="addNarratorForm.languageType.indexOf('西班牙文')>=0" @click="checkedOne('西班牙文')"> 西班牙文
                                </label>
                                <label class="checkbox-inline">
                                    <input type="checkbox" name="lan" value="5" :checked="addNarratorForm.languageType.indexOf('其他')>=0" @click="checkedOne('其他')"> 其他
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="phone" class="col-sm-2 control-label"><span class="red">*</span>联系电话</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="phone" oninput="value=value.replace(/[^\d]/g,'')"  v-model="addNarratorForm.phone">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="job" class="col-sm-2 control-label">职务</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="job" v-model="addNarratorForm.duties">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="note" class="col-sm-2 control-label">备注</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="note" v-model="addNarratorForm.remarks">
                            </div>
                        </div>
                    </form>
                    <div class="btn-box col-lg-8 col-md-10 col-sm-12 col-xs-12">
                        <div class="btn submit" @click="提交讲解员()">保存</div>
                    </div>
                </div>
                <!-- 讲解员查询 -->
                <div class="clearfix" v-else-if="tabCurrent == 2">
                    <form class="form-inline form">
                        <div class="form-group">
                            <label for="groupName2">组别</label>
                            <input type="text" class="form-control" id="groupName2" v-model="narratorSearchForm.groupName">
                        </div>
                        <div class="form-group">
                            <label for="name2">姓名</label>
                            <input type="text" class="form-control" id="name2" v-model="narratorSearchForm.name">
                        </div>
                        <div class="form-group">
                            <label for="sex2">性别</label>
                            <select class="form-control" v-model="narratorSearchForm.sex">
                                <option value="">全部</option>
                                <option value="1">男</option>
                                <option value="0">女</option>
                            </select>
                        </div>
                        <div class="form-group">
                            <label for="education2">学历</label>
                            <input type="text" class="form-control" id="education2" v-model="narratorSearchForm.education">
                        </div>
                        <div class="form-group">
                            <label for="level2">岗级</label>
                            <input type="text" class="form-control" id="level2" v-model="narratorSearchForm.jobLevel">
                        </div>
                        <div class="form-group">
                            <label for="language2">语种</label>
                            <select class="form-control" id="language2" v-model="narratorSearchForm.languageType">
                                <option value="">全部</option>
                                <option value="中文">中文</option>
                                <option value="英文">英文</option>
                                <option value="日文">日文</option>
                                <option value="韩文">韩文</option>
                                <option value="西班牙文">西班牙文</option>
                                <option value="其他">其他</option>
                            </select>
                        </div>
                    </form>
                    <div class="btn-box col-lg-12 col-md-12 col-sm-12 col-xs-12">
                        <div class="btn submit" @click="currentPage=1,获取讲解员()">筛选</div>
                        <div class="btn fabu" @click="导出表格()">导出</div>
                    </div>
                    <div class="table-box">
                        <div class="table-responsive">
                            <table class="table">
                                <thead>
                                    <tr>
                                        <th>序号</th>
                                        <th>组别</th>
                                        <th>姓名</th>
                                        <th>性别</th>
                                        <th>学历</th>
                                        <th>入职时间</th>
                                        <th>岗级</th>
                                        <th>语种</th>
                                        <th>联系电话</th>
                                        <th>职务</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr v-for="(item,i) in narratorList" :key="i">
                                        <td class="active">{{item.id}}</td>
                                        <td class="success">{{item.groupName}}</td>
                                        <td class="warning">{{item.name}}</td>
                                        <td class="danger">{{item.sex === '1' ? '男' : '女'}}</td>
                                        <td class="info">{{item.education}}</td>
                                        <td class="active">{{item.hiredate}}</td>
                                        <td class="success">{{item.jobLevel}}</td>
                                        <td class="warning">{{item.languageType}}</td>
                                        <td class="danger">{{item.phone}}</td>
                                        <td class="info">{{item.duties}}</td>
                                        <td class="success">
                                            <span class="u_btn cus" data-toggle="modal" data-target="#myModal" @click="查看(item,0)">查看</span>
                                            <span class="u_btn cus" data-toggle="modal" data-target="#myModal2" @click="查看(item,1)">修改</span>
                                            <span class="u_btn cus" data-toggle="modal" data-target="#delModal" @click="删除(item.id)">删除</span>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                        <nav aria-label="Page navigation" class="u_pager hidden-xs">
                            <span class="total">总计{{total}}人</span>
                            <ul class="pagination">
                                <li :class="currentPage === 1 ? 'disabled' : ''" @click="topPage">
                                    <a href="javascript:void(0);" aria-label="Previous">
                                        <span aria-hidden="true">&laquo;</span>
                                    </a>
                                </li>
                                <!-- <li v-for="i in userPages" :class="currentPage === i ? 'active' : ''" @click="selectPage(i)"><a href="javascript:void(0);">{{i}}</a></li> -->
                                <li v-show="userPages.length < 10" v-for="i in userPages" :class="currentPage === i ? 'active' : ''" @click="selectPage(i)"><a href="javascript:void(0);">{{i}}</a></li>
                                <li v-show="userPages.length > 9" v-for="i in userPages" :class="currentPage === i ? 'active' : ''" @click="selectPage(i)">
                                    <a href="javascript:void(0);" v-if="i == 1 || i == 2 || i == currentPage || i == (currentPage - 1) || i == (currentPage + 1) || i == (userPages.length) || i == (userPages.length - 1)">{{i}}</a>
                                    <a class="u_page_n" href="javascript:void(0);" v-else-if="i == (currentPage - 2)|| i == (currentPage + 2)"><span aria-hidden="true">...</span></a>
                                </li>
                                <li :class="currentPage === userPages[userPages.length-1] ? 'disabled' : ''" @click="nextPage">
                                    <a href="javascript:void(0);" aria-label="Next">
                                        <span aria-hidden="true">&raquo;</span>
                                    </a>
                                </li>
                            </ul>
                        </nav>
                        <nav class="u_pager visible-xs-block">
                            <ul class="pager">
                                <li @click="topPage" :class="currentPage === 1 ? 'disabled' : ''"><a href="javascript:void(0);">上一页</a></li>
                                <li @click="nextPage" :class="currentPage === userPages[userPages.length-1] ? 'disabled' : ''"><a href="javascript:void(0);">下一页</a></li>
                            </ul>
                        </nav>
                    </div>
                    <div class="table-box" style="display: none">
                        <div class="table-responsive">
                            <table class="table" id="narratorTable">
                                <thead>
                                    <tr>
                                        <th>序号</th>
                                        <th>组别</th>
                                        <th>姓名</th>
                                        <th>性别</th>
                                        <th>学历</th>
                                        <th>入职时间</th>
                                        <th>岗级</th>
                                        <th>语种</th>
                                        <th>联系电话</th>
                                        <th>职务</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr v-for="(item,i) in narratorList" :key="i">
                                        <td class="active">{{item.id}}</td>
                                        <td class="success">{{item.groupName}}</td>
                                        <td class="warning">{{item.name}}</td>
                                        <td class="danger">{{item.sex === '1' ? '男' : '女'}}</td>
                                        <td class="info">{{item.education}}</td>
                                        <td class="active">{{item.hiredate}}</td>
                                        <td class="success">{{item.jobLevel}}</td>
                                        <td class="warning">{{item.languageType === '0' ? '汉语' : item.languageType === '1' ? '英语' : item.languageType === '2' ? '日语' : '韩语'}}</td>
                                        <td class="danger">{{item.phone}}</td>
                                        <td class="info">{{item.duties}}</td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <!-- 讲解工作录入 -->
                <div class="clearfix job_entry" v-else-if="tabCurrent == 3">
                    <!-- 当天在岗讲解员 -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h1 class="panel-title" style="font-size: 20px">当天在岗讲解员</h1>
                        </div>
                        <div class="panel-body">
                            <form class="form-horizontal col-xs-12 col-sm-12 col-md-8 col-lg-4">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">日期</label>
                                    <div class="col-sm-9">
                                        <input type="date" class="form-control" v-model="narratorForm1.entryTime">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">出入口</label>
                                    <div class="col-sm-9">
                                        <select class="form-control" v-model="narratorForm1.entryExit">
                                            <option style="display: none" value="">请选择</option>
                                            <option value="正门">正门</option>
                                            <option value="北门">北门</option>
                                            <option value="南门">南门</option>
                                            <option value="东门">东门</option>
                                        </select>
                                    </div>
                                </div>
                            </form>
                            <div class="clearfix full"></div>
                            <div class="select_narrator_box col-xs-12 col-sm-12 col-md-8 col-lg-8">
                                <div class="w50">
                                    <span class="u_span">在岗讲解员</span>
                                    <div class="img-box">
                                        <ul class="list-group">
                                            <li class="list-group-item" v-for="(item,i) in narratorIn1" :key='i'>
                                                <div class="checkbox">
                                                    <label >
                                                        <input type="checkbox" :value="item" v-model="narratorSelect2" >{{item.name}}
                                                    </label>
                                                </div>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                                <div class="symbol">
                                    <div class="symbol-item symbol-left">
                                        <span class="cus" @click="clickSymbol(1)">&lt;&lt;</span>
                                    </div>
                                    <div class="symbol-item symbol-right">
                                        <span class="cus" @click="clickSymbol(2)">&gt;&gt;</span>
                                    </div>
                                </div>
                                <div class="w50">
                                    <span class="u_span">选择讲解员</span>
                                    <div class="img-box">
                                        <ul class="list-group">
                                            <li class="list-group-item" v-for="(item,i) in narratorList1" :key="i">
                                                <div class="checkbox">
                                                    <label >
                                                        <input type="checkbox" :value="item" v-model="narratorSelect1" >{{item.name}}
                                                    </label>
                                                </div>
                                            </li>
                                        </ul>
                                        
                                    </div>
                                </div>
                            </div>
                            <div class="clearfix full"></div>
                            <div class="btn-box">
                                <div class="btn submit" @click="当天在岗讲解员提交()">提交</div>
                            </div>
                        </div>
                    </div>
                    <!-- 讲解日志记录 -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h1 class="panel-title" style="font-size: 20px">讲解日志记录</h1>
                        </div>
                        <div class="panel-body">
                            <form class="form-horizontal col-xs-12 col-sm-12 col-md-8 col-lg-4">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">日期</label>
                                    <div class="col-sm-9">
                                        <input type="date" class="form-control" v-model="narratorForm2.entryTime">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">出入口</label>
                                    <div class="col-sm-9">
                                        <select class="form-control" v-model="narratorForm2.entryExit"  @change="exitChange">
                                            <option style="display: none" value="">请选择</option>
                                            <option value="正门">正门</option>
                                            <option value="北门">北门</option>
                                            <option value="南门">南门</option>
                                            <option value="东门">东门</option>
                                        </select>
                                    </div>
                                </div>
                            </form>
                            <div class="clearfix full"></div>
                            <div class="select_narrator_box col-xs-12 col-sm-12 col-md-8 col-lg-8">
                                <div class="w50">
                                    <span class="u_span">在岗讲解员</span>
                                    <div class="img-box">
                                        <ul class="list-group">
                                            <li class="list-group-item" v-for="item in narratorIn2">
                                                <div class="checkbox">
                                                    <label>
                                                        <input type="checkbox" name="narrator1" :value="item" v-model="narratorSelect4">{{item.name}}
                                                    </label>
                                                </div>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                                <div class="symbol">
                                    <div class="symbol-item symbol-left">
                                        <span class="cus" @click="clickSymbol(3)">&lt;&lt;</span>
                                    </div>
                                    <div class="symbol-item symbol-right">
                                        <span class="cus"  @click="clickSymbol(4)">&gt;&gt;</span>
                                    </div>
                                </div>
                                <div class="w50">
                                    <span class="u_span">选择讲解员</span>
                                    <div class="img-box">
                                        <ul class="list-group">
                                            <li class="list-group-item" v-for="item in narratorList2">
                                                <div class="checkbox">
                                                    <label>
                                                        <input type="checkbox" name="narrator1" :value="item" v-model="narratorSelect3">{{item.name}}
                                                    </label>
                                                </div>
                                            </li>
                                            <li v-if="narratorList2.length == 0">请先录入该出入口的当天在岗讲解员数据</li>
                                        </ul>
                                        
                                    </div>
                                </div>
                            </div>
                            <div class="clearfix full"></div>
                            <form class="form-horizontal col-xs-12 col-sm-12 col-md-8 col-lg-4" style="margin-top:20px;">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">讲解类型</label>
                                    <div class="col-sm-9">
                                        <select class="form-control"  v-model="narratorForm2.commtatorType">
                                            <option style="display: none" value="">请选择</option>
                                            <option value="0">定时</option>
                                            <option value="1">人工</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">服务游客数</label>
                                    <div class="col-sm-9">
                                        <input type="number" class="form-control" v-model="narratorForm2.serviceNums">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">出发时间</label>
                                    <div class="col-sm-9">
                                        <input type="time" class="form-control" @blur="getReturnTime" v-model="narratorForm2.departureTime">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">预计返回时间</label>
                                    <div class="col-sm-9">
                                        <input type="time" class="form-control" v-model="narratorForm2.estimatedReturnTime">
                                    </div>
                                </div>
                                <div class="form-group" v-show="narratorForm2.commtatorType === '0'">
                                    <label class="col-sm-2 control-label">下批讲解时间</label>
                                    <div class="col-sm-9">
                                        <input type="datetime-local" class="form-control" v-model="narratorForm2.nextTime">
                                    </div>
                                </div>
                            </form>
                            <div class="btn-box">
                                <div class="btn submit" @click="讲解日志提交()">提交</div>
                            </div>
                            <div class="table-box">
                                <div class="table-responsive">
                                    <table class="table">
                                        <thead>
                                            <tr>
                                                <th>日期</th>
                                                <th>出入口</th>
                                                <th>出发讲解员</th>
                                                <th>讲解类型</th>
                                                <th>出发时间</th>
                                                <th>预计返回时间</th>
                                                <th>下批讲解时间</th>
                                                <th>录入人</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr v-for="(item,i) in logList">
                                                <td class="active">{{item.entryTime}}</td>
                                                <td class="success">{{item.entryExit}}</td>
                                                <td class="warning">{{item.name}}</td>
                                                <td class="danger">{{item.commtatorType === '1' ? '人工' : '定时'}}</td>
                                                <td class="info">{{item.departureTime}}</td>
                                                <td class="active">{{item.estimatedReturnTime}}</td>
                                                <td>{{item.nextTime ? timeFormat('yyyy-MM-dd hh:mm',item.nextTime) : '--'}}</td>
                                                <td class="success">{{item.operator}}</td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <nav aria-label="Page navigation" class="u_pager hidden-xs">
                                    <span class="total">总计{{total1}}条</span>
                                    <ul class="pagination">
                                        <li :class="currentPage1 === 1 ? 'disabled' : ''" @click="topPage($event,1)">
                                            <a href="javascript:void(0);" aria-label="Previous">
                                                <span aria-hidden="true">&laquo;</span>
                                            </a>
                                        </li>
                                        <!-- <li v-for="i in userPages1" :class="currentPage1 === i ? 'active' : ''" @click="selectPage(i,1)"><a href="javascript:void(0);">{{i}}</a></li> -->
                                        <li v-show="userPages1.length < 10" v-for="i in userPages1" :class="currentPage1 === i ? 'active' : ''" @click="selectPage(i,1)"><a href="javascript:void(0);">{{i}}</a></li>
                                        <li v-show="userPages1.length > 9" v-for="i in userPages1" :class="currentPage1 === i ? 'active' : ''" @click="selectPage(i,1)">
                                            <a href="javascript:void(0);" v-if="i == 1 || i == 2 || i == currentPage1 || i == (currentPage1 - 1) || i == (currentPage1 + 1) || i == (userPages1.length) || i == (userPages1.length - 1)">{{i}}</a>
                                            <a class="u_page_n" href="javascript:void(0);" v-else-if="i == (currentPage1 - 2)|| i == (currentPage1 + 2)"><span aria-hidden="true">...</span></a>
                                        </li>
                                        <li :class="currentPage1 === userPages1[userPages1.length-1] ? 'disabled' : ''" @click="nextPage($event,1)">
                                            <a href="javascript:void(0);" aria-label="Next">
                                                <span aria-hidden="true">&raquo;</span>
                                            </a>
                                        </li>
                                    </ul>
                                </nav>
                                <nav class="u_pager visible-xs-block">
                                    <ul class="pager">
                                        <li @click="topPage($event,1)" :class="currentPage1 === 1 ? 'disabled' : ''"><a href="javascript:void(0);">上一页</a></li>
                                        <li @click="nextPage($event,1)" :class="currentPage1 === userPages1[userPages1.length-1] ? 'disabled' : ''"><a href="javascript:void(0);">下一页</a></li>
                                    </ul>
                                </nav>
                            </div>
                        </div>
                    </div>
                    <!-- 语音讲解机租借 -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h1 class="panel-title" style="font-size: 20px">语音讲解机租借</h1>
                        </div>
                        <div class="panel-body">
                            <form class="form-horizontal col-xs-12 col-sm-12 col-md-8 col-lg-4">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">日期</label>
                                    <div class="col-sm-9">
                                        <input type="date" class="form-control" v-model="deviceForm1.leaseDay">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">出入口</label>
                                    <div class="col-sm-9">
                                        <select class="form-control" v-model="deviceForm1.inwardOutward">
                                            <option style="display: none" value="">请选择</option>
                                            <option value="正门">正门</option>
                                            <option value="北门">北门</option>
                                            <option value="南门">南门</option>
                                            <option value="东门">东门</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">租借时间</label>
                                    <div class="col-sm-9">
                                        <input class="form-control" type="time" v-model="deviceForm1.leaseTime">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">租借数量</label>
                                    <div class="col-sm-9">
                                        <input type="number" class="form-control" v-model="deviceForm1.leaseNum">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">剩余数量</label>
                                    <div class="col-sm-9">
                                        <input type="number" class="form-control" v-model="deviceForm1.numberRemaining">
                                        <span id="helpBlock" class="help-block">共计{{(deviceForm1.leaseNum && deviceForm1.numberRemaining) ? (parsInt(deviceForm1.leaseNum) + parsInt(deviceForm1.numberRemaining)) : '--'}}台</span>
                                    </div>
                                </div>
                            </form>
                            <div class="btn-box" style="margin-top: 20px">
                                <div class="btn submit" @click="语音讲解机添加记录()">提交</div>
                            </div>
                            <div class="table-box">
                                <div class="table-responsive">
                                    <table class="table">
                                        <thead>
                                            <tr>
                                                <th>日期</th>
                                                <th>出入口</th>
                                                <th>租借时间</th>
                                                <th>租借数量</th>
                                                <th>剩余数量</th>
                                                <th>录入人</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr v-for="(item,i) in this.deviceList1">
                                                <td class="active">{{item.leaseDay}}</td>
                                                <td class="success">{{item.inwardOutward}}</td>
                                                <td class="warning">{{item.leaseTime}}</td>
                                                <td class="danger">{{item.leaseNum}}</td>
                                                <td class="info">{{item.numberRemaining}}</td>
                                                <td class="success">{{item.operator}}</td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <nav aria-label="Page navigation" class="u_pager hidden-xs">
                                    <span class="total">总计{{total2}}条</span>
                                    <ul class="pagination">
                                        <li :class="currentPage2 === 1 ? 'disabled' : ''" @click="topPage($event,2)">
                                            <a href="javascript:void(0);" aria-label="Previous">
                                                <span aria-hidden="true">&laquo;</span>
                                            </a>
                                        </li>
                                        <!-- <li v-for="i in userPages2" :class="currentPage2 === i ? 'active' : ''" @click="selectPage(i,2)"><a href="javascript:void(0);">{{i}}</a></li> -->
                                        <li v-show="userPages2.length < 10" v-for="i in userPages2" :class="currentPage2 === i ? 'active' : ''" @click="selectPage(i,2)"><a href="javascript:void(0);">{{i}}</a></li>
                                        <li v-show="userPages2.length > 9" v-for="i in userPages2" :class="currentPage2 === i ? 'active' : ''" @click="selectPage(i,2)">
                                            <a href="javascript:void(0);" v-if="i == 1 || i == 2 || i == currentPage2 || i == (currentPage2 - 1) || i == (currentPage2 + 1) || i == (userPages2.length) || i == (userPages2.length - 1)">{{i}}</a>
                                            <a class="u_page_n" href="javascript:void(0);" v-else-if="i == (currentPage2 - 2)|| i == (currentPage2 + 2)"><span aria-hidden="true">...</span></a>
                                        </li>
                                        <li :class="currentPage2 === userPages2[userPages2.length-1] ? 'disabled' : ''" @click="nextPage($event,2)">
                                            <a href="javascript:void(0);" aria-label="Next">
                                                <span aria-hidden="true">&raquo;</span>
                                            </a>
                                        </li>
                                    </ul>
                                </nav>
                                <nav class="u_pager visible-xs-block">
                                    <ul class="pager">
                                        <li @click="topPage($event,2)" :class="currentPage2 === 1 ? 'disabled' : ''"><a href="javascript:void(0);">上一页</a></li>
                                        <li @click="nextPage($event,2)" :class="currentPage2 === userPages2[userPages2.length-1] ? 'disabled' : ''"><a href="javascript:void(0);">下一页</a></li>
                                    </ul>
                                </nav>
                            </div>
                        </div>
                    </div>
                    <!-- 平板导览租借 -->
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h1 class="panel-title" style="font-size: 20px">平板导览租借</h1>
                        </div>
                        <div class="panel-body">
                            <form class="form-horizontal col-xs-12 col-sm-12 col-md-8 col-lg-4">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">日期</label>
                                    <div class="col-sm-9">
                                        <input type="date" class="form-control" v-model="deviceForm2.leaseDay">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">出入口</label>
                                    <div class="col-sm-9">
                                        <select class="form-control" v-model="deviceForm2.inwardOutward">
                                            <option style="display: none" value="">请选择</option>
                                            <option value="正门">正门</option>
                                            <option value="北门">北门</option>
                                            <option value="南门">南门</option>
                                            <option value="东门">东门</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">租借时间</label>
                                    <div class="col-sm-9">
                                        <input class="form-control" type="time" v-model="deviceForm2.leaseTime">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">租借数量</label>
                                    <div class="col-sm-9">
                                        <input type="number" class="form-control" v-model="deviceForm2.leaseNum">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">剩余数量</label>
                                    <div class="col-sm-9">
                                        <input type="number" class="form-control" v-model="deviceForm2.numberRemaining">
                                        <span id="helpBlock" class="help-block">共计{{(deviceForm2.leaseNum && deviceForm2.numberRemaining) ? (parsInt(deviceForm2.leaseNum) + parsInt(deviceForm2.numberRemaining)) : '--'}}台</span>
                                    </div>
                                </div>
                            </form>
                            <div class="btn-box" style="margin-top: 20px">
                                <div class="btn submit" @click="平板导览添加记录()">提交</div>
                            </div>
                            <div class="table-box">
                                <div class="table-responsive">
                                    <table class="table">
                                        <thead>
                                            <tr>
                                                <th>日期</th>
                                                <th>出入口</th>
                                                <th>租借时间</th>
                                                <th>租借数量</th>
                                                <th>剩余数量</th>
                                                <th>录入人</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <tr v-for="(item,i) in this.deviceList2">
                                                <td class="active">{{item.leaseDay}}</td>
                                                <td class="success">{{item.inwardOutward}}</td>
                                                <td class="warning">{{item.leaseTime}}</td>
                                                <td class="danger">{{item.leaseNum}}</td>
                                                <td class="info">{{item.numberRemaining}}</td>
                                                <td class="success">{{item.operator}}</td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                                <nav aria-label="Page navigation" class="u_pager hidden-xs">
                                    <span class="total">总计{{total3}}条</span>
                                    <ul class="pagination">
                                        <li :class="currentPage3 === 1 ? 'disabled' : ''" @click="topPage($event,3)">
                                            <a href="javascript:void(0);" aria-label="Previous">
                                                <span aria-hidden="true">&laquo;</span>
                                            </a>
                                        </li>
                                        <!-- <li v-for="i in userPages3" :class="currentPage3 === i ? 'active' : ''" @click="selectPage(i,3)"><a href="javascript:void(0);">{{i}}</a></li> -->
                                        <li v-show="userPages3.length < 10" v-for="i in userPages3" :class="currentPage3 === i ? 'active' : ''" @click="selectPage(i,3)"><a href="javascript:void(0);">{{i}}</a></li>
                                        <li v-show="userPages3.length > 9" v-for="i in userPages3" :class="currentPage3 === i ? 'active' : ''" @click="selectPage(i,3)">
                                            <a href="javascript:void(0);" v-if="i == 1 || i == 2 || i == currentPage3 || i == (currentPage3 - 1) || i == (currentPage3 + 1) || i == (userPages3.length) || i == (userPages3.length - 1)">{{i}}</a>
                                            <a class="u_page_n" href="javascript:void(0);" v-else-if="i == (currentPage3 - 2)|| i == (currentPage3 + 2)"><span aria-hidden="true">...</span></a>
                                        </li>
                                        <li :class="currentPage3 === userPages3[userPages3.length-1] ? 'disabled' : ''" @click="nextPage($event,3)">
                                            <a href="javascript:void(0);" aria-label="Next">
                                                <span aria-hidden="true">&raquo;</span>
                                            </a>
                                        </li>
                                    </ul>
                                </nav>
                                <nav class="u_pager visible-xs-block">
                                    <ul class="pager">
                                        <li @click="topPage($event,3)" :class="currentPage3 === 1 ? 'disabled' : ''"><a href="javascript:void(0);">上一页</a></li>
                                        <li @click="nextPage($event,3)" :class="currentPage3 === userPages3[userPages3.length-1] ? 'disabled' : ''"><a href="javascript:void(0);">下一页</a></li>
                                    </ul>
                                </nav>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- 讲解工作查询 -->
                <div class="clearfix" v-else-if="tabCurrent == 4">
                    <form class="form-inline form">
                        <div class="form-group">
                            <label>日期</label>
                            <input type="date" class="form-control" v-model="searchForm.startDate">
                            <span style="color:#676a6c">-</span>
                            <input type="date" class="form-control" v-model="searchForm.endDate">
                        </div>
                        <div class="form-group">
                            <label>出入口</label>
                            <select class="form-control" v-model="searchForm.aspect">
                                <option value="">全部</option>
                                <option value="正门">正门</option>
                                <option value="北门">北门</option>
                                <option value="南门">南门</option>
                                <option value="东门">东门</option>
                            </select>
                        </div>
                    </form>
                    <div class="btn-box col-lg-12 col-md-12 col-sm-12 col-xs-12">
                        <div class="btn submit" @click="获取讲解工作记录(2)">筛选</div>
                        <div class="btn fabu" @click="导出表格(2)">导出</div>
                    </div>
                    <div class="table-box">
                        <div class="table-responsive">
                            <table class="table" id="jobTable">
                                <thead>
                                    <tr>
                                        <th>日期</th>
                                        <th>出入口</th>
                                        <th>在岗讲解员数</th>
                                        <th>讲解批次</th>
                                        <th>语音导览机总数（实时）</th>
                                        <th>租用次数</th>
                                        <th>平板导览机总数（实时）</th>
                                        <th>租用次数</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr v-for="(item,i) in jobList">
                                        <td class="active">{{item.recordTime}}</td>
                                        <td class="success">{{item.inwardOutward}}</td>
                                        <td class="warning">{{item.onlineCommtatorCount}}</td>
                                        <td class="danger">{{item.commtatorCount}}</td>
                                        <td class="info">{{item.explainCount}}</td>
                                        <td class="active">{{item.explainLeaseCount}}</td>
                                        <td class="success">{{item.ipadCount}}</td>
                                        <td class="warning">{{item.ipadLeaseCount}}</td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                        <nav aria-label="Page navigation" class="u_pager hidden-xs">
                            <span class="total">总计{{total4}}人</span>
                            <ul class="pagination">
                                <li :class="currentPage4 === 1 ? 'disabled' : ''" @click="topPage($event,4)">
                                    <a href="javascript:void(0);" aria-label="Previous">
                                        <span aria-hidden="true">&laquo;</span>
                                    </a>
                                </li>
                                <!-- <li v-for="i in userPages4" :class="currentPage4 === i ? 'active' : ''" @click="selectPage(i,4)"><a href="javascript:void(0);">{{i}}</a></li> -->
                                <li v-show="userPages4.length < 10" v-for="i in userPages4" :class="currentPage4 === i ? 'active' : ''" @click="selectPage(i,4)"><a href="javascript:void(0);">{{i}}</a></li>
                                <li v-show="userPages4.length > 9" v-for="i in userPages4" :class="currentPage4 === i ? 'active' : ''" @click="selectPage(i,4)">
                                    <a href="javascript:void(0);" v-if="i == 1 || i == 2 || i == currentPage4 || i == (currentPage4 - 1) || i == (currentPage4 + 1) || i == (userPages4.length) || i == (userPages4.length - 1)">{{i}}</a>
                                    <a class="u_page_n" href="javascript:void(0);" v-else-if="i == (currentPage4 - 2)|| i == (currentPage4 + 2)"><span aria-hidden="true">...</span></a>
                                </li>
                                <li :class="currentPage4 === userPages4[userPages4.length-1] ? 'disabled' : ''" @click="nextPage($event,4)">
                                    <a href="javascript:void(0);" aria-label="Next">
                                        <span aria-hidden="true">&raquo;</span>
                                    </a>
                                </li>
                            </ul>
                        </nav>
                        <nav class="u_pager visible-xs-block">
                            <ul class="pager">
                                <li @click="topPage($event,4)" :class="currentPage4 === 1 ? 'disabled' : ''"><a href="javascript:void(0);">上一页</a></li>
                                <li @click="nextPage($event,4)" :class="currentPage4 === userPages4[userPages4.length-1] ? 'disabled' : ''"><a href="javascript:void(0);">下一页</a></li>
                            </ul>
                        </nav>
                    </div>
                </div>
            </div>
        </div>
        <div class="footer">
            Copyright 成都杜甫草堂博物馆
        </div>
        <!-- 查看讲解员模态框 -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">查看讲解员</h4>
                </div>
                <div class="modal-body">
                    <ul class="list-group">
                        <li class="list-group-item">姓名：{{editForm.name}}</li>
                        <li class="list-group-item">组别：{{editForm.groupName}}</li>
                        <li class="list-group-item">性别：{{editForm.sex === '1' ? '男' : '女'}}</li>
                        <li class="list-group-item">学历：{{editForm.education}}</li>
                        <li class="list-group-item">岗级：{{editForm.jobLevel}}</li>
                        <li class="list-group-item">语种：{{editForm.languageType}}</li>
                        <li class="list-group-item">联系电话：{{editForm.phone}}</li>
                        <li class="list-group-item">职务：{{editForm.duties}}</li>
                        <li class="list-group-item">备注：{{editForm.remark}}</li>
                    </ul>
                    <div class="img-box">
                        <img :src="baseUrl + editForm.img" alt="">
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                </div>
                </div>
            </div>
        </div>
        <!-- 修改讲解员模态框 -->
        <div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel2">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close" @click="获取讲解员()"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">修改讲解员</h4>
                </div>
                <div class="modal-body">
                    <ul class="list-group">
                        <li class="list-group-item" for="name3">姓名：
                            <input id="name3" type="text" v-model="editForm.name" style="width: 30%">
                        </li>
                        <li class="list-group-item">组别：
                            <input type="text" v-model="editForm.groupName" style="width: 30%">
                        </li>
                        <li class="list-group-item">性别：
                            <select style="width: 30%" v-model="editForm.sex">
                                <option value="1">男</option>
                                <option value="0">女</option>
                            </select>
                        </li>
                        <li class="list-group-item">学历：
                            <input type="text" v-model="editForm.education" style="width: 30%">
                        </li>
                        <li class="list-group-item">岗级：
                            <input type="text" v-model="editForm.jobLevel" style="width: 30%">
                        </li>
                        <li class="list-group-item">语种：
                            <!-- <select style="width: 30%" v-model="editForm.languageType">
                                <option value="0">汉语</option>
                                <option value="1">英语</option>
                                <option value="2">日语</option>
                                <option value="3">韩语</option>
                            </select> -->
                            <label class="checkbox-inline">
                                <input type="checkbox" name="lan" value="0" :checked="editForm.languageType.indexOf('中文')>=0" @click="editeCheckedOne('中文')"> 中文
                            </label>
                            <label class="checkbox-inline">
                                <input type="checkbox" name="lan" value="1" :checked="editForm.languageType.indexOf('英文')>=0" @click="editeCheckedOne('英文')"> 英文
                            </label>
                            <label class="checkbox-inline">
                                <input type="checkbox" name="lan" value="2" :checked="editForm.languageType.indexOf('日文')>=0" @click="editeCheckedOne('日文')"> 日文
                            </label>
                            <label class="checkbox-inline">
                                <input type="checkbox" name="lan" value="3" :checked="editForm.languageType.indexOf('韩文')>=0" @click="editeCheckedOne('韩文')"> 韩文
                            </label>
                            <label class="checkbox-inline">
                                <input type="checkbox" name="lan" value="4" :checked="editForm.languageType.indexOf('西班牙文')>=0" @click="editeCheckedOne('西班牙文')"> 西班牙文
                            </label>
                            <label class="checkbox-inline">
                                <input type="checkbox" name="lan" value="5" :checked="editForm.languageType.indexOf('其他')>=0" @click="editeCheckedOne('其他')"> 其他
                            </label>
                        </li>
                        <li class="list-group-item">联系电话：
                            <input type="text" v-model="editForm.phone" oninput="value=value.replace(/[^\d]/g,'')" style="width: 30%">
                        </li>
                        <li class="list-group-item">职务：
                            <input type="text" v-model="editForm.duties" style="width: 30%">
                        </li>
                        <li class="list-group-item">备注：
                            <input type="text" v-model="editForm.remark" style="width: 30%">
                        </li>
                    </ul>
                    <label class="img-box cus" title="点击更换图片" for="uploadimg">
                        <img :src="baseUrl + editForm.img" alt="" @load="imgSuccess" @error="imgErr" v-show="imgType">
                        <i class="add glyphicon glyphicon-plus" v-show="!imgType"></i>
                        <input type="file" style="display: none" id="uploadimg" accept="image/*" @change="imgUpload($event,2)">
                    </label>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal" @click="获取讲解员()">关闭</button>
                    <button type="button" class="btn btn-primary" @click="保存修改()">保存</button>
                </div>
                </div>
            </div>
        </div>
        <!-- 警告框 -->
        <div class="modal fade" id="delModal" tabindex="-1" role="dialog" aria-labelledby="delModal">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">警告</h4>
                    </div>
                    <div class="modal-body">
                        你确定要删除吗？
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal" @click="()=>{delId=''}">取消</button>
                        <button type="button" v-show="this.delId" class="btn btn-danger" @click="确认删除()">确认</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- 加载动画 -->
        <div class="loading" v-show="!complete">
            <div class="spinner">
                <div class="spinner-container container1">
                    <div class="circle1"></div>
                    <div class="circle2"></div>
                    <div class="circle3"></div>
                    <div class="circle4"></div>
                </div>
                <div class="spinner-container container2">
                    <div class="circle1"></div>
                    <div class="circle2"></div>
                    <div class="circle3"></div>
                    <div class="circle4"></div>
                </div>
                <div class="spinner-container container3">
                    <div class="circle1"></div>
                    <div class="circle2"></div>
                    <div class="circle3"></div>
                    <div class="circle4"></div>
                </div>
            </div>
        </div>
    </div>
    <script src="./static/js/jquery-3.3.1.min.js"></script>
    <script src="./static/js/bootstrap.js"></script>
    <script src="./static/js/vue.min.js"></script>
    <script src="./static/js/axios.min.js"></script>
    <script src="./static/api/api.js"></script>
    <script src="./static/js/prism.js"></script>
    <script src="./static/js/spop.min.js"></script>
    <script src="./static/js/jszip.min.js"></script>
    <script src="./static/js/FileSaver.js"></script>
    <script src="./static/js/excel-gen.js"></script>
    <script>
        const tabs = {
            1: '讲解员录入',
            2: '讲解员查询',
            3: '讲解工作录入',
            4: '讲解工作查询'
        }
        var narrator = new Vue({
            el: '#narrator',
            data() {
                return {
                    complete: false,
                    time: this.timeFormat('hh:mm'),
                    date: this.timeFormat('yyyy年MM月dd日'),
                    week: this.timeFormat('D'),
                    baseUrl: api.baseUrl,
                    roles: store.fetch('userLoginInfo').roles,
                    userData: store.fetch('userLoginInfo'),
                    tabCurrent: 1,
                    tabs: tabs,
                    //===================>讲解员录入<====================
                    addNarratorForm: {
                        duties: '',//职务
                        education: '',//学历
                        groupName: '',//组别
                        hiredate: '',//入职时间
                        img: '',//照片
                        jobLevel: '',//岗级
                        languageType: [],//语种
                        name: '',//姓名
                        phone: '',//电话
                        remarks: '',//备注
                        sex: '',//性别
                        img: ''
                    },
                    //====================>讲解员查询<========================
                    narratorList: [],
                    narratorSearchForm: {
                        education: '',
                        groupName: '',
                        jobLevel: '',
                        languageType: '',
                        name: '',
                        sex: ''
                    },
                    pageSize: 10,
                    currentPage: 1,
                    total: 0,
                    userPages: [],//页数
                    editForm: {
                        name: '',
                        groupName: '',
                        sex: '',
                        education: '',
                        jobLevel: '',
                        languageType: [],
                        phone: '',
                        duties: '',
                        remark: '',
                        img: '',
                    },
                    delId: '',
                    //===================>讲解工作录入<=======================
                    //---------讲解员录入-----
                    narratorList1: [],//讲解员列表
                    narratorList2: [],
                    allNarratorList: [],
                    narratorSelect1: [],//选中列表
                    narratorSelect2: [],
                    narratorSelect3: [],
                    narratorSelect4: [],
                    narratorIn1: [],//当天在岗讲解员列表
                    narratorIn2: [],//讲解日志记录在岗讲解员列表
                    narratorForm1: {
                        entryExit: '',
                        entryTime: this.timeFormat('yyyy-MM-dd'),
                        operator: store.fetch('userLoginInfo').userName,
                        status: '1'
                    },
                    //------讲解日志记录------
                    narratorForm2: {
                        commtatorType: '',
                        departureTime: '',//出发时间
                        entryExit: '',
                        entryTime: this.timeFormat('yyyy-MM-dd'),
                        estimatedReturnTime: '',//返回时间
                        name: '',
                        operator: store.fetch('userLoginInfo').userName,
                        serviceNums: '',
                        status: '1',
                        nextTime: this.timeFormat('yyyy-MM-ddThh:mm').split('T')[0] + 'T' + '00:00'
                    },
                    logList: [],
                    pageSize1: 5,
                    currentPage1: 1,
                    total1: 0,
                    userPages1: [],//页数
                    //语音讲解机表单
                    deviceForm1: {
                        deviceType: '0',
                        inwardOutward: '',
                        leaseDay: this.timeFormat('yyyy-MM-dd'),
                        leaseNum: 0,
                        leaseTime: '',
                        numberRemaining: 0,
                        operator: store.fetch('userLoginInfo').userName, 
                    },
                    deviceList1:[],
                    pageSize2: 5,
                    currentPage2: 1,
                    total2: 0,
                    userPages2: [],//页数
                    //平板导览
                    deviceForm2: {
                        deviceType: '1',
                        inwardOutward: '',
                        leaseDay: this.timeFormat('yyyy-MM-dd'),
                        leaseNum: 0,
                        leaseTime: '',
                        numberRemaining: 0,
                        operator: store.fetch('userLoginInfo').userName, 
                    },
                    deviceList2:[],
                    pageSize3: 5,
                    currentPage3: 1,
                    total3: 0,
                    userPages3: [],//页数
                    //讲解工作记录
                    pageSize4: 10,
                    currentPage4: 1,
                    total4: 0,
                    userPages4: [],//页数
                    jobList: [],
                    searchForm: {
                        startDate: '',
                        endDate: '',
                        aspect: ''
                    },
                    imgType: true,
                }
            },
            created() {
                
            },
            mounted() {
                this.init();
            },
            methods: {
                //初始化
                init() {
                    this.getDate();
                    if(this.menuConfig('讲解员录入')) {
                        this.tabClick(1);
                        return false;
                    }
                    if(this.menuConfig('讲解员查询')) {
                        this.tabClick(2);
                        return false;
                    }
                    if(this.menuConfig('讲解工作录入')) {
                        this.tabClick(3);
                        return false;
                    }
                    if(this.menuConfig('讲解工作查询')) {
                        this.tabClick(4);
                        return false;
                    }
                },
                parsInt(str) {
                    return parseInt(str)
                },
                //权限判断
                menuConfig(menuName) {
                    let re = new RegExp(menuName);
                    return re.test(this.roles);
                },
                
                //tab切换
                tabClick(i) {
                    this.tabCurrent = i;
                    this.complete = false;
                    if(i === 1) {
                        this.complete = true;
                        this.addNarratorForm = {
                            duties: '',//职务
                            education: '',//学历
                            groupName: '',//组别
                            hiredate: '',//入职时间
                            img: '',//照片
                            jobLevel: '',//岗级
                            languageType: [],//语种
                            name: '',//姓名
                            phone: '',//电话
                            remarks: '',//备注
                            sex: '',//性别
                            img: ''
                        }
                    }
                    if(i === 2) {
                        this.获取讲解员();
                    }
                    if(i=== 3) {
                        this.获取在职讲解员(2);
                        this.获取全部讲解日志();
                        this.获取讲解机记录();
                        this.获取平板记录();
                        this.narratorIn1 = [];
                        this.narratorIn2 = [];
                    }
                    if(i === 4) {
                        this.获取讲解工作记录()
                    }
                },

                //时间格式化
                timeFormat(fmt,time=false) {
                    if(time) {
                        var date = new Date(time)
                    }else {
                        var date = new Date();
                    }
                    let week = {
                        0: '日',
                        1: '一',
                        2: '二',
                        3: '三',
                        4: '四',
                        5: '五',
                        6: '六'
                    }
                    var o = { 
                        "M+" : date.getMonth()+1,     //月份 
                        "d+" : date.getDate(),     //日 
                        "h+" : date.getHours(),     //小时 
                        "m+" : date.getMinutes(),     //分 
                        "s+" : date.getSeconds(),     //秒 
                        "q+" : Math.floor((date.getMonth()+3)/3), //季度 
                        "S" : date.getMilliseconds(),    //毫秒
                        "D" : week[date.getDay()]
                    }; 
                    if(/(y+)/.test(fmt)) 
                    fmt=fmt.replace(RegExp.$1, (date.getFullYear()+"").substr(4 - RegExp.$1.length)); 
                    for(var k in o) 
                    if(new RegExp("("+ k +")").test(fmt)) 
                    fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length))); 
                    return fmt;
                },

                imgErr() {
                    this.imgType = false;
                },

                imgSuccess() {
                    this.imgType = true;
                },

                //动态获取时间、
                getDate() {
                    setInterval(() => {
                        this.time = this.timeFormat('hh:mm');
                        this.date = this.timeFormat('yyyy年MM月dd日');
                        this.week = this.timeFormat('D')
                    },1000)
                },

                //登出
                logout() {
                    store.clear('userLoginInfo');
                    store.clear('userData');
                    window.location.href = '/login.html'
                },

                //提示通知
                通知(title,msg,type) {
                    spop({
                        template: '<h4 class="spop-title">'+title+'</h4>'+msg,
                        style: type,
                        autoclose: 3000
                    });
                },

                //----------------------讲解员录入--------------
                //表单验证
                表单验证() {
                    let data = this.addNarratorForm;
                    // console.log(data);
                    // return false;
                    if(!data.groupName || !data.name || !data.img || !data.sex || !data.education || !data.hiredate || !data.jobLevel || data.languageType.length < 1 || !data.phone) {
                        this.通知('错误','请填写带*号的必填项!','error');
                        return false;
                    }else {
                        return true;
                    }
                },

                checkedOne (type) {
                    let types = this.addNarratorForm.languageType.indexOf(type)
                    if (types >= 0) {//如果已经包含就去除
                        this.addNarratorForm.languageType.splice(types, 1)
                    } else {//如果没有包含就添加
                        // console.log(this.addNarratorForm)
                        this.addNarratorForm.languageType.push(type)
                    }
                },

                //图片文件上传
                imgUpload(e,i=1) {
                    let formData = new FormData();
                    let file = e.target.files[0];
                    if(!file) {
                        return false
                    }
                    formData.append('fileName',file);
                    api.upload(formData).then(res => {
                        if(res.data.status == 'success') {
                            if(i === 1) {
                                this.addNarratorForm.img = file.name
                            }else {
                                this.editForm.img = file.name
                            }
                            this.通知('提示','图片上传成功！','success')
                        }else {
                            this.通知('错误','图片上传失败!','error')
                        }
                    }).catch(err => {
                        this.通知('错误','图片上传失败!','error')
                    })
                    e.target.value = '';
                },

                提交讲解员() {
                    if(this.表单验证()) {
                        let body = {...this.addNarratorForm};
                        body.languageType = body.languageType.join(',');
                        console.log(body);
                        // return false;
                        api.添加讲解员(body).then(res => {
                            if(res.data.status == 'success') {
                                this.addNarratorForm = {
                                    duties: '',//职务
                                    education: '',//学历
                                    groupName: '',//组别
                                    hiredate: '',//入职时间
                                    img: '',//照片
                                    jobLevel: '',//岗级
                                    languageType: [],//语种
                                    name: '',//姓名
                                    phone: '',//电话
                                    remarks: '',//备注
                                    sex: '',//性别
                                    img: ''
                                };
                                this.通知('提示','录入成功！','success');
                                let body = {
                                    author: this.userData.userName,
                                    moduleChileName: '讲解员录入',
                                    moduleName: '讲解员管理',
                                    operation: '录入一名讲解员'
                                }
                                this.recordLog(body)
                            }else {
                                this.通知('错误','录入失败!','error')
                            }
                        }).catch(err => {
                            this.通知('错误','服务器开小差了，请稍后再试！','error')
                        })
                    }
                },

                //---------------------讲解员查询---------------
                //点击页码
                selectPage(i,type=0) {
                    if(type === 0) {
                        this.currentPage = i;
                        this.获取讲解员();
                        return false
                    }
                    if(type === 1) {
                        this.currentPage1 = i;
                        this.获取全部讲解日志();
                        return false;
                    }
                    if(type === 2) {
                        this.currentPage2 = i;
                        this.获取讲解机记录();
                        return false;
                    }
                    if(type === 3) {
                        this.currentPage3 = i;
                        this.获取平板记录()
                        return false;
                    }
                    if(type === 4) {
                        this.currentPage4 = i;
                        this.获取讲解工作记录()
                        return false;
                    }
                },
                //上一页
                topPage(e,type=0) {
                    console.log(type)
                    if(type === 0) {
                        if(this.currentPage === 1) {
                            return false;
                        }
                        this.currentPage --;
                        this.获取讲解员()
                    }
                    if(type === 1) {
                        if(this.currentPage1 === 1) {
                            return false;
                        }
                        this.currentPage1 --;
                        this.获取全部讲解日志();
                    }
                    if(type === 2) {
                        if(this.currentPage2 === 1) {
                            return false;
                        }
                        this.currentPage2 --;
                        this.获取讲解机记录();
                    }
                    if(type === 3) {
                        if(this.currentPage3 === 1) {
                            return false;
                        }
                        this.currentPage3 --;
                        this.获取平板记录();
                    }
                    if(type === 4) {
                        if(this.currentPage4 === 1) {
                            return false;
                        }
                        this.currentPage4 --;
                        this.获取讲解工作记录()
                        return false;
                    }
                },
                //下一页
                nextPage(e,type=0) {
                    if(type === 0) {
                        if(this.currentPage === this.userPages[this.userPages.length-1]) {
                            return false;
                        }
                        this.currentPage ++;
                        this.获取讲解员();
                    }
                    if(type === 1) {
                        if(this.currentPage1 === this.userPages1[this.userPages1.length-1]) {
                            return false;
                        }
                        this.currentPage1 ++;
                        this.获取全部讲解日志();
                    }
                    if(type === 2) {
                        if(this.currentPage2 === this.userPages2[this.userPages2.length-1]) {
                            return false;
                        }
                        this.currentPage2 ++;
                        this.获取讲解机记录();
                    }
                    if(type === 3) {
                        if(this.currentPage3 === this.userPages3[this.userPages3.length-1]) {
                            return false;
                        }
                        this.currentPage3 ++;
                        this.获取平板记录();
                    }
                    if(type === 4) {
                        if(this.currentPage4 === this.userPages4[this.userPages4.length-1]) {
                            return false;
                        }
                        this.currentPage4 ++;
                        this.获取讲解工作记录();
                    }
                },
                //查询讲解员
                获取讲解员(i=1,type=1) {
                    if(type === 1) {
                        var body = {
                            pageNum: this.currentPage,
                            pageSize: this.pageSize
                        };
                    }else {
                        var body = {
                            pageNum: 1,
                            pageSize: 10000
                        }
                    }
                    if(i=== 1) {
                        let search = this.narratorSearchForm;
                        if(search.education) {
                            body.education = search.education
                        }
                        if(search.groupName) {
                            body.groupName = search.groupName
                        }
                        if(search.jobLevel) {
                            body.jobLevel = search.jobLevel
                        }
                        if(search.languageType) {
                            body.languageType = search.languageType
                        }
                        if(search.name) {
                            body.name = search.name
                        }
                        if(search.sex) {
                            body.sex = search.sex
                        }
                    }
                    this.complete = false;
                    api.查询所有讲解员(body).then(res => {
                        this.complete = true;
                        if(res.data.status == 'success') {
                            let data = res.data.data.list;
                            for (const i in data) {
                                if(data[i].hiredate) {
                                    data[i].hiredate = data[i].hiredate.split(' ')[0];
                                }
                            }
                            if(i === 1) {
                                this.narratorList = data;
                                this.userPages = res.data.data.navigatepageNums;
                                this.total = res.data.data.total;
                            }else {
                                this.narratorList1 = data;
                                this.narratorList2 = [];
                                this.allNarratorList = [];
                                for (const item of data) {
                                    this.allNarratorList.push(item)
                                    // this.narratorList2.push(item)
                                }
                                
                            }
                        }
                    }).catch(err => {
                        this.complete = true;
                        this.通知('提示','服务器开小差了，请稍后再试！','error');
                    })
                },

                导出表格(type=1) {
                    if(type === 1) {
                        let excel = new ExcelGen({
                            "src_id": 'narratorTable',
                            "show_header": true,
                            "excel_name": '讲解员列表第' + this.currentPage + '页'
                        });
                        excel.generate()
                        let body = {
                            author: this.userData.userName,
                            moduleChileName: '讲解员查询',
                            moduleName: '讲解员管理',
                            operation: '导出讲解员列表'
                        }
                        this.recordLog(body)
                    }else {
                        let excel = new ExcelGen({
                            "src_id": 'jobTable',
                            "show_header": true,
                            "excel_name": '讲解工作列表第' + this.currentPage4 + '页'
                        });
                        excel.generate()
                        let body = {
                            author: this.userData.userName,
                            moduleChileName: '讲解工作查询',
                            moduleName: '讲解员管理',
                            operation: '导出讲解工作列表'
                        }
                        this.recordLog(body)
                    }
                },

                查看(item,type) {
                    const row = {...item};
                    const arr = [];
                    row.languageType = row.languageType.split(',');
                    for (let index = 0; index < row.languageType.length; index++) {
                        if(row.languageType[index] !== ' ' && row.languageType[index] !== '0') {
                            arr.push(row.languageType[index])
                        }
                    }
                    this.editForm = row;
                    if(type === 1) {
                        this.editForm.languageType = arr;
                    }else {
                        this.editForm.languageType = this.editForm.languageType.join(',')
                    }
                },

                editeCheckedOne (type) {
                    let types = this.editForm.languageType.indexOf(type)
                    if (types >= 0) {//如果已经包含就去除
                        this.editForm.languageType.splice(types, 1)
                    } else {//如果没有包含就添加
                        // console.log(this.editForm)
                        this.editForm.languageType.push(type)
                    }
                },

                保存修改() {
                    let body = this.editForm;
                    body.languageType = body.languageType.join(',');
                    api.更新讲解员(body).then(res => {
                        if(res.data.status == 'success') {
                            this.通知('提示','修改成功！','success');
                            $('#myModal2').modal('hide');
                            this.获取讲解员()
                            let body = {
                                author: this.userData.userName,
                                moduleChileName: '讲解员查询',
                                moduleName: '讲解员管理',
                                operation: '修改一名讲解员数据'
                            }
                            this.recordLog(body)
                        }else {
                            this.通知('提示','修改失败！','error');
                        }
                    }).catch(err => {
                        this.通知('提示','服务器开小差了，请稍后再试！','error');
                    })
                },
                
                删除(id) {
                    this.delId = id;
                },
                
                确认删除() {
                    let body = {
                        id: this.delId
                    }
                    api.删除讲解员(body).then(res => {
                        if(res.data.status == 'success') {
                            this.通知('提示','删除成功！','success');
                            $('#delModal').modal('hide');
                            this.获取讲解员()
                            let body = {
                                author: this.userData.userName,
                                moduleChileName: '讲解员查询',
                                moduleName: '讲解员管理',
                                operation: '删除一名讲解员'
                            }
                            this.recordLog(body)
                        }else {
                            this.通知('错误','删除失败！','error');
                            $('#delModal').modal('hide');
                        }
                    }).catch(err => {
                        this.通知('错误','服务器开小差了，请稍后再试！','error');
                    })
                },
                
                //--------------------讲解工作录入--------------
                //获取所有讲解员
                获取在职讲解员(type) {
                    this.获取讲解员(2,type)
                },
                //-----------当天在岗讲解员--------
                
                clickSymbol(e) {
                    let del = (data,delData) => {
                        let delArr = [];
                        for (let index = 0; index < data.length; index++) {
                            for (let i = 0; i < delData.length; i++) {
                                // console.log(delData[i].id , data[index].id)
                                if(data[index].id == delData[i].id) {
                                   delArr.unshift(index)
                                }
                            }
                        }
                        // console.log(delArr)
                        for (const i of delArr) {
                            data.splice(i,1)
                        }
                        
                    };
                    let add = (data,addData) => {
                        for (const i in addData) {
                            data.push(addData[i]);
                        };
                    }
                    if(e === 1) {
                        del(this.narratorList1,this.narratorSelect1);
                        // console.log(this.narratorList1)
                        add(this.narratorIn1,this.narratorSelect1);
                        this.narratorSelect1 = [];
                    }else if(e === 2) {
                        del(this.narratorIn1,this.narratorSelect2);
                        add(this.narratorList1,this.narratorSelect2);
                        this.narratorSelect2 = [];
                    }else if(e === 3) {
                        del(this.narratorList2,this.narratorSelect3);
                        add(this.narratorIn2,this.narratorSelect3);
                        this.narratorSelect3 = [];
                    }else if(e === 4) {
                        del(this.narratorIn2,this.narratorSelect4);
                        add(this.narratorList2,this.narratorSelect4);
                        this.narratorSelect4 = [];
                    }
                    
                },
                
                当天在岗讲解员提交() {
                    let body = {
                        params: []
                    }
                    if(!this.narratorForm1.entryExit) {
                        this.通知('错误','请选择出入口','error');
                        return false;
                    }
                    if(this.narratorIn1.length > 0) {
                        for (const item of this.narratorIn1) {
                            let one = {
                                exit: this.narratorForm1.entryExit,
                                inputTime: this.narratorForm1.entryTime,
                                name: '',
                                operator: this.narratorForm1.operator,
                                status: '1',
                                commentatorId: ''
                            }
                            one.name = item.name;
                            one.commentatorId = item.id;
                            body.params.push(one)
                        }
                    }else {
                        this.通知('错误','请选择在岗讲解员!','error');
                        return false;
                    }
                    api.批量添加在岗人员(body).then(res => {
                        if(res.data.status == 'success') {
                            let body = {
                                inward_outward: this.narratorForm1.entryExit,
                                time: this.narratorForm1.entryTime
                            }
                            api.添加讲解工作(body).then(res => {
                                if(res.data.status == 'success') {
                                    this.通知('提示','录入成功！','success');
                                    this.获取在职讲解员(2);
                                    this.narratorIn1 = [];
                                    this.narratorForm1 = {
                                        entryExit: '',
                                        entryTime: this.timeFormat('yyyy-MM-dd'),
                                        operator: store.fetch('userLoginInfo').userName,
                                        status: '1'
                                    };
                                    let body = {
                                        author: this.userData.userName,
                                        moduleChileName: '讲解员工作日志',
                                        moduleName: '讲解员管理',
                                        operation: '添加在岗讲解员'
                                    }
                                    this.recordLog(body)
                                }else {
                                    this.通知('提示','录入失败！','error');
                                }
                            }).catch(err => {
                                this.通知('提示','服务器开小差了，请稍后再试！','error');
                            })
                        }else {
                            this.通知('提示','录入失败！','error');
                        }
                    }).catch(err => {
                        this.通知('提示','服务器开小差了，请稍后再试！','error');
                    })
                },

                exitChange() {
                    let body = {
                        time: this.narratorForm2.entryTime,
                        entryExit : this.narratorForm2.entryExit
                    }
                    api.getOnlineCommentator(body).then(res => {
                        console.log(res.data)
                        if(res.data.status == 'success') {
                            if(res.data.data.length > 0) {
                                this.narratorList2 = [...res.data.data];
                                for (let index = 0; index < this.narratorList2.length; index++) {
                                    this.narratorList2[index].id = this.narratorList2[index].commentatorId
                                }
                                // console.log(this.narratorList2)
                            }else {
                                // this.获取讲解员(2,2)
                                this.narratorList2 = [];
                            }
                        }
                    })
                },
                
                //------------讲解日志记录------------
                getReturnTime() {
                    let arr = this.narratorForm2.departureTime.split(':');
                    let h = parseInt(arr[0]) + 1;
                    let m = parseInt(arr[1]) + 40;
                    if(m > 59) {
                        m = m - 60;
                        h++
                    }
                    if(h > 23) {
                        h = h - 24;
                    }
                    if(h < 10) {
                        h = '0' + h ;
                    }
                    if(m < 10) {
                        m = '0' + m;
                    }
                    let str = h + ':' + m;
                    this.narratorForm2.estimatedReturnTime = str;
                },
                
                讲解日志提交() {
                    let body = {
                        params: []
                    }
                    if(!this.narratorForm2.entryExit) {
                        this.通知('错误','请选择出入口','error');
                        return false;
                    }
                    if(!this.narratorForm2.commtatorType) {
                        this.通知('错误','请选择讲解类型','error');
                        return false;
                    }
                    if(!this.narratorForm2.serviceNums) {
                        this.通知('错误','请填写服务游客数','error');
                        return false;
                    }else if(parseInt(this.narratorForm2.serviceNums) < 1) {
                        this.通知('错误','请填写正确的服务游客数','error');
                        return false;
                    }
                    if(!this.narratorForm2.departureTime) {
                        this.通知('错误','请填写出发时间','error');
                        return false;
                    }
                    if(this.narratorForm2.commtatorType === '0') {
                        if(!this.narratorForm2.nextTime) {
                            this.通知('错误','请填写正确的下批次讲解时间！','error');
                            return false;
                        }else if(this.timeFormat('yyyyMMddhhmm',this.narratorForm2.nextTime) < this.timeFormat('yyyyMMddhhmm')){
                            this.通知('错误','请填写正确的下批次讲解时间！','error');
                            return false;
                        }
                    }else {
                        this.narratorForm2.nextTime = '';
                    }
                    if(this.narratorIn2.length > 0) {
                        for (const item of this.narratorIn2) {
                            let one = {
                                commtatorType: this.narratorForm2.commtatorType,
                                departureTime: this.narratorForm2.departureTime,
                                entryExit: this.narratorForm2.entryExit,
                                entryTime: this.narratorForm2.entryTime,
                                estimatedReturnTime: this.narratorForm2.estimatedReturnTime,
                                name: '',
                                operator: this.narratorForm2.operator,
                                serviceNums: this.narratorForm2.serviceNums,
                                status: '1',
                                nextTime: this.narratorForm2.nextTime
                            }
                            one.name = item.name;
                            body.params.push(one)
                        }
                        api.批量添加讲解日志(body).then(res => {
                            if(res.data.status == 'success') {
                                let body = {
                                    inward_outward: this.narratorForm2.entryExit,
                                    time: this.narratorForm2.entryTime
                                }
                                api.更新讲解批次(body).then(res => {
                                    if(res.data.status == 'success') {
                                        this.通知('提示','录入成功！','success');
                                        this.获取在职讲解员(2,2);
                                        this.narratorIn2 = [];
                                        this.narratorForm2 = {
                                            commtatorType: '',
                                            departureTime: '',//出发时间
                                            entryExit: '',
                                            entryTime: this.timeFormat('yyyy-MM-dd'),
                                            estimatedReturnTime: '',//返回时间
                                            name: '',
                                            operator: store.fetch('userLoginInfo').userName,
                                            serviceNums: '',
                                            status: '1',
                                            nextTime: this.timeFormat('yyyy-MM-ddThh:mm').split('T')[0] + 'T' + '00:00'
                                        };
                                        this.narratorList2 = [...this.allNarratorList];
                                        this.获取全部讲解日志();
                                        let body = {
                                            author: this.userData.userName,
                                            moduleChileName: '讲解员工作日志',
                                            moduleName: '讲解员管理',
                                            operation: '录入讲解日志'
                                        }
                                        this.recordLog(body)
                                    }else {
                                        this.通知('提示','录入失败！','error');
                                    }
                                }).catch(err => {
                                    this.通知('提示','服务器开小差了，请稍后再试！','error');
                                })
                            }else {
                                this.通知('提示','录入失败！','error');
                            }
                        }).catch(err => {
                            this.通知('提示','服务器开小差了，请稍后再试！','error');
                        })
                    }else {
                        this.通知('错误','请选择在岗讲解员!','error');
                        return false;
                    }
                },
                
                获取全部讲解日志() {
                    let body = {
                        pageNum: this.currentPage1,
                        pageSize: this.pageSize1,
                    }
                    api.查询所有日志(body).then(res => {
                        if(res.data.status == 'success') {
                            let data = res.data.data;
                            let list = data.list;
                            this.logList = list;
                            this.total1 = data.total;
                            this.userPages1 = data.navigatepageNums;
                        }
                    }).catch(err => {
                        this.complete = true;
                        this.通知('提示','服务器开小差了，请稍后再试！','error');
                    })
                },

                //---------------------语音讲解机--------------
                语音讲解机添加记录() {
                    if(!this.deviceForm1.inwardOutward) {
                        this.通知('错误','请选择出入口','error');
                        return false;
                    }
                    if(!this.deviceForm1.leaseTime) {
                        this.通知('错误','请填写租借时间','error');
                        return false;
                    }
                    if(!this.deviceForm1.leaseNum) {
                        this.通知('错误','请填写租借数量','error');
                        return false;
                    }else if(parseInt(this.deviceForm1.leaseNum) < 0) {
                        this.通知('错误','请填写正确的租借数量','error');
                        return false;
                    }
                    if(!this.deviceForm1.numberRemaining) {
                        this.通知('错误','请填写剩余数量','error');
                        return false;
                    }else if(parseInt(this.deviceForm1.numberRemaining) < 0) {
                        this.通知('错误','请填写正确的剩余数量','error');
                        return false;
                    }
                    let body = this.deviceForm1;
                    api.添加设备(body).then(res => {
                        if(res.data.status == 'success') {
                            let body = {
                                explain_count: parseInt(this.deviceForm1.leaseNum) + parseInt(this.deviceForm1.numberRemaining),
                                explain_lease_count: this.deviceForm1.leaseNum,
                                inward_outward: this.deviceForm1.inwardOutward,
                                time: this.deviceForm1.leaseDay
                            }
                            api.更新讲解机数量(body).then(res => {
                                if(res.data.status == 'success') {
                                    this.通知('提示','录入成功','success');
                                    this.deviceForm1 = {
                                        deviceType: '0',
                                        inwardOutward: '',
                                        leaseDay: this.timeFormat('yyyy-MM-dd'),
                                        leaseNum: 0,
                                        leaseTime: '',
                                        numberRemaining: 0,
                                        operator: store.fetch('userLoginInfo').userName, 
                                    }
                                    this.获取讲解机记录()
                                    let body = {
                                        author: this.userData.userName,
                                        moduleChileName: '讲解员工作日志',
                                        moduleName: '讲解员管理',
                                        operation: '录入讲解机租借记录'
                                    }
                                    this.recordLog(body)
                                }else {
                                    this.通知('错误','录入失败！','error');
                                }
                            }).catch(err => {
                                this.通知('提示','服务器开小差了，请稍后再试！','error');
                            })
                        }else {
                            this.通知('错误','录入失败！','error');
                        }
                    }).catch(err => {
                        this.通知('提示','服务器开小差了，请稍后再试！','error');
                    })
                },

                获取讲解机记录() {
                    let body = {
                        pageNum: this.currentPage2,
                        pageSize: this.pageSize2,
                        type: 0
                    };
                    api.获取设备记录(body).then(res => {
                        if(res.data.status == 'success') {
                            let data = res.data.data;
                            let list = data.list;
                            this.deviceList1 = list;
                            this.total2 = data.total;
                            this.userPages2 = data.navigatepageNums;
                        }
                    }).catch(err => {
                        this.通知('提示','服务器开小差了，请稍后再试！','error');
                    })
                },

                平板导览添加记录() {
                    if(!this.deviceForm2.inwardOutward) {
                        this.通知('错误','请选择出入口','error');
                        return false;
                    }
                    if(!this.deviceForm2.leaseTime) {
                        this.通知('错误','请填写租借时间','error');
                        return false;
                    }
                    if(!this.deviceForm2.leaseNum) {
                        this.通知('错误','请填写租借数量','error');
                        return false;
                    }else if(parseInt(this.deviceForm2.leaseNum) < 0) {
                        this.通知('错误','请填写正确的租借数量','error');
                        return false;
                    }
                    if(!this.deviceForm2.numberRemaining) {
                        this.通知('错误','请填写剩余数量','error');
                        return false;
                    }else if(parseInt(this.deviceForm2.numberRemaining) < 0) {
                        this.通知('错误','请填写正确的剩余数量','error');
                        return false;
                    }
                    let body = this.deviceForm2;
                    api.添加设备(body).then(res => {
                        if(res.data.status == 'success') {
                            let body = {
                                inward_outward: this.deviceForm2.inwardOutward,
                                ipad_count: parseInt(this.deviceForm2.leaseNum) + parseInt(this.deviceForm2.numberRemaining),
                                ipad_lease_count: this.deviceForm2.leaseNum,
                                time: this.deviceForm2.leaseDay
                            }
                            api.更新平板数量(body).then(res => {
                                if(res.data.status == 'success') {
                                    this.通知('提示','录入成功','success');
                                    this.deviceForm2 = {
                                        deviceType: '1',
                                        inwardOutward: '',
                                        leaseDay: this.timeFormat('yyyy-MM-dd'),
                                        leaseNum: 0,
                                        leaseTime: '',
                                        numberRemaining: 0,
                                        operator: store.fetch('userLoginInfo').userName, 
                                    }
                                    this.获取平板记录()
                                    let body = {
                                        author: this.userData.userName,
                                        moduleChileName: '讲解员工作日志',
                                        moduleName: '讲解员管理',
                                        operation: '录入平板导览设备租借记录'
                                    }
                                    this.recordLog(body)
                                }else {
                                    this.通知('错误','录入失败！','error');
                                }
                            }).catch(err => {
                                this.通知('提示','服务器开小差了，请稍后再试！','error');
                            })
                        }else {
                            this.通知('错误','录入失败！','error');
                        }
                    }).catch(err => {
                        this.通知('提示','服务器开小差了，请稍后再试！','error');
                    })
                },

                获取平板记录() {
                    let body = {
                        pageNum: this.currentPage3,
                        pageSize: this.pageSize3,
                        type: 1
                    };
                    api.获取设备记录(body).then(res => {
                        if(res.data.status == 'success') {
                            let data = res.data.data;
                            let list = data.list;
                            this.deviceList2 = list;
                            this.total3 = data.total;
                            this.userPages3 = data.navigatepageNums;
                        }
                    }).catch(err => {
                        this.通知('提示','服务器开小差了，请稍后再试！','error');
                    })
                },

                //--------------------讲解工作查询-------------
                获取讲解工作记录(type=1) {
                    if(type === 2) {
                        this.currentPage4 = 1;
                    }
                    let body = {
                        pageNum: this.currentPage4,
                        pageSize: this.pageSize4
                    }
                    if(this.searchForm.aspect) {
                        body.aspect = this.searchForm.aspect
                    }
                    if(this.searchForm.startDate) {
                        body.startDate = this.searchForm.startDate;
                        body.endDate = this.searchForm.endDate;
                    }
                    if(this.searchForm.startDate) {
                        if(new Date(this.searchForm.startDate) > new Date()) {
                            this.通知('错误','您选择的开始时间无效！','error');
                            return false;
                        }
                        if(!this.searchForm.endDate) {
                            this.通知('错误','您选择的结束时间无效！','error');
                            return false;
                        }
                        body.startDate = this.searchForm.startDate
                    }
                    if(this.searchForm.endDate) {
                        if(!this.searchForm.startDate) {
                            this.通知('错误','您选择的开始时间无效！','error');
                            return false;
                        }
                        body.endDate = this.searchForm.endDate
                    }
                    if(this.searchForm.startDate && this.searchForm.endDate) {
                        if((new Date(this.searchForm.startDate).valueOf() - new Date(this.searchForm.endDate).valueOf()) > 0) {
                            this.通知('错误','您选择时间区间无效！','error');
                            return false;
                        }
                    }
                    this.complete = false;
                    api.讲解工作查询(body).then(res => {
                        this.complete = true;
                        if(res.data.status == 'success') {
                            let data = res.data.data;
                            let list = data.list;
                            this.jobList = list;
                            this.total4 = data.total;
                            this.userPages4 = data.navigatepageNums;
                        }
                    }).catch(err => {
                        this.通知('提示','服务器开小差了，请稍后再试！','error');
                    })
                },

                recordLog(body,fn=false) {
                    api.updateLog(body).then(res => {
                        if(fn) {
                            let newFN = new Function(fn);
                            newFN();
                        }
                    }).catch(err => {
                        console.error(err)
                    })
                },
            }
        })
    </script>
</body>
</html>